local zhuangrong = fk.CreateSkill {

  name = "joy__zhuangrong",

  tags = { Skill.Wake, },

}



zhuangrong:addEffect(fk.TurnEnd, {
  name = "joy__zhuangrong",
  frequency = Skill.Wake,
  events = {fk.TurnEnd},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(zhuangrong.name) and player:usedSkillTimes(zhuangrong.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
    return #player.player_cards[Player.Hand] == 1 or player.hp == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:changeMaxHp(player, -1)
    if player:isWounded() then
      room:recover({
        who = player,
        num = player:getLostHp(),
        recoverBy = player,
        skillName = zhuangrong.name
      })
    end
    local n = player.maxHp - #player.player_cards[Player.Hand]
    if n > 0 then
      player:drawCards(n, zhuangrong.name)
    end
    room:handleAddLoseSkills(player, "nya__shenwei|wushuang", nil, true, false)
  end,
})

return zhuangrong